Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app-namespace usage for cluster options #1333

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

praveenrewar
Copy link
Member

@praveenrewar praveenrewar commented Sep 24, 2023

What this PR does / why we need it:

During the introduction of defaultNamespace feature, we started using --app-namespace flag from kapp which should be used carefully when using cluster options instead of service account

The behaviour while using cluster options would be:

  • If defaultNamespace is not used
    • kapp app and resources (if metadata.namespace is not provided) are created in cluster.Namespace if it is provided, or else the namespace from the kubeconfig is used.
  • If defaultNamespace is provided
    • If cluster.Namespace is provided, then the kapp would be created there and the default namespace for the resources would be the defaultNamespace.
    • If clusterNamespace is not provided, then kapp app would be created in the kubeconfig namespace and the default namespace for the resources would be the defaultNamespace.
cluster.namespace defaultNamespace desired behaviour PR behaviour
meta: cluster.namespace, resources: cluster.namespace Same as desired behaviour
meta: cluster.namespace, resources: defaultNamespace Same as desired behaviour
meta: kubeconfig namespace, resources: defaultNamespace Same as desired behaviour
meta: kubeconfig namespace, meta: kubeconfig namespace Same as desired behaviour

TODO

  • Manual testing for the above scenarios.

Which issue(s) this PR fixes:

Fixes #1332

Does this PR introduce a user-facing change?


Additional Notes for your reviewer:

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


@praveenrewar praveenrewar force-pushed the installation-namespace-fix branch 2 times, most recently from a47edbd to 83691e9 Compare September 25, 2023 19:45
@praveenrewar praveenrewar marked this pull request as ready for review September 26, 2023 05:25
@praveenrewar praveenrewar force-pushed the installation-namespace-fix branch 3 times, most recently from 30b854f to 2ea8ff3 Compare September 26, 2023 14:04
Copy link
Contributor

@neil-hickey neil-hickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it's honestly quite confusing overall, not the PR but our general code flow because of all the scenarios. The tests nicely illustrate it, but the code is ... rough. Happy to refactor later on at some point.

During the introduction of defaultNamespace feature, we started using --app-namespace flag from kapp which should be used carefully when using cluster options instead of service account

Signed-off-by: Praveen Rewar <[email protected]>
@praveenrewar praveenrewar force-pushed the installation-namespace-fix branch from 2ea8ff3 to 7eea80e Compare September 27, 2023 05:31
@praveenrewar praveenrewar merged commit e66ee80 into develop Sep 27, 2023
10 checks passed
@praveenrewar praveenrewar deleted the installation-namespace-fix branch September 27, 2023 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Version 0.48.0 introduced bug/regression when installing using kubeconfig to separate cluster.
2 participants